home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 125
/
Freelog_MarsAvril2015_No125.iso
/
Musique
/
Quod Libet
/
quodlibet-3.3.0-installer.exe
/
bin
/
quodlibet
/
formats
/
spc.pyc
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2014-12-31
|
2KB
|
75 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 2.7)
import os
from quodlibet.formats._audio import AudioFile
extensions = [
'.spc']
class SPCFile(AudioFile):
format = 'SPC700'
def __init__(self, filename):
h = open(filename, 'rb')
try:
head = h.read(46)
if len(head) != 46 or head[:27] != 'SNES-SPC700 Sound File Data':
raise IOError('Not a valid SNES-SPC700 file')
if head[35] == '\x1a':
data = h.read(210)
if len(data) == 210:
self.update(parse_id666(data))
finally:
h.close()
self.setdefault('title', os.path.basename(filename)[:-4])
self.sanitize(filename)
def write(self):
pass
def can_change(self, k = None):
TAGS = [
'artist',
'album',
'title',
'comments']
if k is None:
return TAGS
return None in TAGS
def parse_id666(data):
tags = { }
tags['title'] = data[:32]
tags['album'] = data[32:64]
tags['dumper'] = data[64:80]
tags['comments'] = data[80:112]
if data[130] < 'A':
try:
tags['~#length'] = int(data[123:126].strip('\x00'))
except ValueError:
pass
tags['artist'] = data[131:163]
else:
tags['artist'] = data[130:162]
for k in tags.keys():
if k[:2] == '~#':
continue
tags[k] = tags[k].replace('\x00', '').decode('ascii', 'ignore')
if not tags[k]:
del tags[k]
continue
return tags
info = SPCFile
types = [
SPCFile]